package com.zc.app.web.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

public class LogExceptionHandler implements HandlerExceptionResolver {

	private static Logger logger = LogManager.getLogger();

	@Override
	public ModelAndView resolveException(HttpServletRequest request,
										 HttpServletResponse response,
										 Object handler, Exception ex) {

		logger.error(ex.getMessage(),ex);

		return new ModelAndView("error");
	}

}
